<template>
  <div class="prevContainer app-container" style="position: relative">
<!--    <div class="prevHeader">-->
<!--      <p style="">{{ currentPage }} / {{ pageCount }}</p>-->
<!--    </div>-->
    <div class="prevBody">
      <pdf
        :src="filePath"
      ></pdf>
    </div>
  </div>
</template>

<script>
import pdf from 'vue-pdf';
import mixins from "@/views/train/mixins";

export default {
  //你的页面路由名称
  name: "Preview",
  mixins: [mixins],
  components: {
    pdf
  },
  data() {
    return {
      filePath: null,//地址
    };
  },
  mounted() {
    // let loadingTask = pdf.createLoadingTask(this.path)
    // loadingTask.promise.then(pdf => {
    // 	this.numPages = pdf.numPages;
    // }).catch(err => {
    // 	console.error('pdf 加载失败', err);
    // })
  },
  created() {
    let filePath = decodeURIComponent(this.$route.params.filePath)
    if (!filePath) {
      this.$message.warning('文件路径为空!')
      return
    }
    this.filePath = filePath;
    console.log(this.filePath)
  },
};
</script>
<style lang="scss" scoped>
.prevContainer {

}

.prevHeader {
  height: 50px;
}

.prevBody{
  overflow: auto;
}

</style>

